Skip to content

Conversation

steve148
Copy link
Contributor

@steve148 steve148 commented Dec 2, 2020

What kind of change does this PR introduce?

Not 100% what to classify this as, but I guess it falls under a feature (non-breaking change).

What is the current behavior?

As per #40, currently projects using this library have to use a very specific version of dependencies which this libraray prescribes. Instead of pinning the versions, we should be allowing all versions of our dependencies which don't break for this project.

What is the new behavior?

With the change here, the project has converted from using == to >= for dependency versions. This still keeps some restrictions on anyone who uses this library to make sure the code functions properly, but also more flexibility in dpendency versions which are acceptable for this project.

Does this PR introduce a breaking change?

No changes, anyone who uses this version of the libraray once it gets released won't have to pin their dependencies with previously limited versions.

Other information

I did find one bug when testing requests==1.0.0 which caused the tests to break. Specifically, in past versions of the requests library asserting equality on HTTPBasicAuth failed because they were instantiated as two distinct instances of hte class. It seems that this was fixed later on so as the equality check would pass, albeit I'm not sure when this fix was made.

Side note, if anyone is interested in how I automaated the process of checking which versions of the project worked / didn't work, let me know and I can put those steps in the comments on this PR.

@steve148 steve148 self-assigned this Dec 2, 2020
@steve148 steve148 added the enhancement New feature or request label Dec 2, 2020
@steve148 steve148 requested review from DaleSeo and xkludge December 2, 2020 02:16
@steve148 steve148 marked this pull request as ready for review December 2, 2020 02:17
@DaleSeo DaleSeo linked an issue Dec 2, 2020 that may be closed by this pull request
Copy link
Contributor

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note, if anyone is interested in how I automaated the process of checking which versions of the project worked / didn't work, let me know and I can put those steps in the comments on this PR.

I feel curious only if it doesn't take you a lot of time.

setup.py Outdated
license="MIT",
packages=["python_graphql_client"],
install_requires=["aiohttp==3.7.3", "requests==2.22.0", "websockets==8.1"],
install_requires=["aiohttp>=3.0.0", "requests>=1.0.0", "websockets>=5.0"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good but I'm a bit concerned that these libraries release a new major version with lots of breaking changes since that's what major versions are for. So, I was just wondering what would be the pip equivalent of the caret(^) range of npm. I guess we can do something like aiohttp==3.*.* to limit the major version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, we can definitely do that! I think the ~= is what would work here.

Suggested change
install_requires=["aiohttp>=3.0.0", "requests>=1.0.0", "websockets>=5.0"],
install_requires=["aiohttp~=3.0", "requests~=2.0", "websockets>=5.0,<9"],

I initially went with a looser restriction on versions since I wasn't sure if it was better to be preventative or reactive to issues caused by major version changes of dependencies. If we restrict to a major version here, say requests v2, then we will need to actively monitor and respond to major version changes of that project. Really the tradeoff is whether we want to avoid any dependency issues and manually test a version bump of a dependency when it comes out or if we want to react to issues as people identify them with allowed versions of dependencies. I think there's merit to both approaches, and the issues I see with manually checking for dependency version bumps is less of a factor if we have something like dependabot or another similar service giving us alerts when a new major version comes out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it sounds like you have great insight into the trade-offs. Leveraging tools like dependabot or renovate for automating dependency management sounds like a good idea. 👍

json={"query": query},
headers={},
auth=HTTPBasicAuth("[email protected]", "not_a_real_password"),
auth=auth,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this but how about we drop support for request v1? I feel like that would be more generous than needed because it's never been supported since this library was created.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last v1 release of requests came out in 2013, so I think that's fair. I was trying to super flexible here with what versions we allow, but in reality this is probably unecessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly about this. I'll leave it up to you. 😃

Copy link
Contributor

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a qucik 🔪 at this! I don't have any blocking comments.

setup.py Outdated
license="MIT",
packages=["python_graphql_client"],
install_requires=["aiohttp==3.7.3", "requests==2.22.0", "websockets==8.1"],
install_requires=["aiohttp>=3.0.0", "requests>=1.0.0", "websockets>=5.0"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it sounds like you have great insight into the trade-offs. Leveraging tools like dependabot or renovate for automating dependency management sounds like a good idea. 👍

json={"query": query},
headers={},
auth=HTTPBasicAuth("[email protected]", "not_a_real_password"),
auth=auth,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly about this. I'll leave it up to you. 😃

@steve148
Copy link
Contributor Author

steve148 commented Dec 2, 2020

@DaleSeo thanks for the review. For posterity's sake, I went with using the compatible release syntax to restrict it to the current major version of aiohttp and requests. The websockets library I kept at >=5.0 since 5.0 release was more recent (2018) and it seems it frequently releases major version changes. It may be worth switching this to pin it to a major version later, which should probably be done with the addition of an alert system for major version changes of dependencies.

@steve148 steve148 merged commit a81ed69 into prodigyeducation:master Dec 3, 2020
@steve148 steve148 deleted the chore/reduce-deps-strictness branch December 3, 2020 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to use more recent versions of dependencies
2 participants